home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / util / moni / Scout-src.lha / netinclude / devices / sana2.h < prev    next >
C/C++ Source or Header  |  2002-09-16  |  13KB  |  408 lines

  1. #ifndef SANA2_SANA2DEVICE_H
  2. #define SANA2_SANA2DEVICE_H 1
  3.  
  4. /*
  5. **      $Filename$
  6. **      $Revision$
  7. **      $Date$
  8. **
  9. **      Structure definitions for SANA-II devices.
  10. **
  11. **      (C) Copyright 1991-2001 Amiga, Inc.
  12. **              All Rights Reserved
  13. */
  14.  
  15. #ifndef EXEC_TYPES_H
  16. #include <exec/types.h>
  17. #endif
  18.  
  19. #ifndef EXEC_PORTS_H
  20. #include <exec/ports.h>
  21. #endif
  22.  
  23. #ifndef EXEC_IO_H
  24. #include <exec/io.h>
  25. #endif
  26.  
  27. #ifndef EXEC_TASKS_H
  28. #include <exec/tasks.h>
  29. #endif
  30.  
  31. #ifndef EXEC_ERRORS_H
  32. #include <exec/errors.h>
  33. #endif
  34.  
  35. #ifndef DEVICES_TIMER_H
  36. #include <devices/timer.h>
  37. #endif
  38.  
  39. #ifndef UTILITY_TAGITEM_H
  40. #include <utility/tagitem.h>
  41. #endif
  42.  
  43. #ifndef UTILITY_HOOKS_H
  44. #include <utility/hooks.h>
  45. #endif
  46.  
  47. #define SANA2_MAX_ADDR_BITS  (128)
  48. #define SANA2_MAX_ADDR_BYTES ((SANA2_MAX_ADDR_BITS+7)/8)
  49.  
  50. struct IOSana2Req
  51. {
  52.     struct IORequest ios2_Req;
  53.  
  54.     ULONG ios2_WireError;                     /* wire type specific error */
  55.     ULONG ios2_PacketType;                    /* packet type */
  56.     UBYTE ios2_SrcAddr[SANA2_MAX_ADDR_BYTES]; /* source address */
  57.     UBYTE ios2_DstAddr[SANA2_MAX_ADDR_BYTES]; /* dest address */
  58.     ULONG ios2_DataLength;                    /* length of packet data */
  59.     APTR  ios2_Data;                          /* packet data */
  60.     APTR  ios2_StatData;                      /* statistics data pointer */
  61.     APTR  ios2_BufferManagement;              /* see SANA-II OpenDevice adoc */
  62. };
  63.  
  64. /*
  65. ** Defines for the io_Flags field
  66. */
  67. #define SANA2IOB_RAW   (7)         /* raw packet IO requested */
  68. #define SANA2IOB_BCAST (6)         /* broadcast packet (received) */
  69. #define SANA2IOB_MCAST (5)         /* multicast packet (received) */
  70. #define SANA2IOB_QUICK (IOB_QUICK) /* quick IO requested (0) */
  71.  
  72. #define SANA2IOF_RAW   (1<<SANA2IOB_RAW)
  73. #define SANA2IOF_BCAST (1<<SANA2IOB_BCAST)
  74. #define SANA2IOF_MCAST (1<<SANA2IOB_MCAST)
  75. #define SANA2IOF_QUICK (IOF_QUICK)
  76.  
  77. /*
  78. ** Defines for OpenDevice() flags
  79. */
  80. #define SANA2OPB_MINE (0) /* exclusive access requested */
  81. #define SANA2OPB_PROM (1) /* promiscuous mode requested */
  82.  
  83. #define SANA2OPF_MINE (1<<SANA2OPB_MINE)
  84. #define SANA2OPF_PROM (1<<SANA2OPB_PROM)
  85.  
  86. /*
  87. ** Defines for OpenDevice() tags
  88. */
  89. #define S2_Dummy             (TAG_USER + 0xB0000)
  90.  
  91. #define S2_CopyToBuff        (S2_Dummy +  1)
  92. #define S2_CopyFromBuff      (S2_Dummy +  2)
  93. #define S2_PacketFilter      (S2_Dummy +  3)
  94. #define S2_CopyToBuff16      (S2_Dummy +  4)
  95. #define S2_CopyFromBuff16    (S2_Dummy +  5)
  96. #define S2_CopyToBuff32      (S2_Dummy +  6)
  97. #define S2_CopyFromBuff32    (S2_Dummy +  7)
  98. #define S2_DMACopyToBuff32   (S2_Dummy +  8)
  99. #define S2_DMACopyFromBuff32 (S2_Dummy +  9)
  100. #define S2_DMACopyToBuff64   (S2_Dummy + 10)
  101. #define S2_DMACopyFromBuff64 (S2_Dummy + 11)
  102. #define S2_Log               (S2_Dummy + 12)
  103.  
  104. /*
  105. ** Filled in by 'S2_DEVICEQUERY'
  106. */
  107. struct Sana2DeviceQuery
  108. {
  109.     /*
  110.     ** Standard information
  111.     */
  112.     ULONG   SizeAvailable;  /* bytes available */
  113.     ULONG   SizeSupplied;   /* bytes supplied */
  114.     ULONG   DevQueryFormat; /* this is type 0 */
  115.     ULONG   DeviceLevel;    /* this document is level 0 */
  116.     /*
  117.     ** Common information
  118.     */
  119.     UWORD   AddrFieldSize;  /* address size in bits */
  120.     ULONG   MTU;            /* maximum packet data size */
  121.     ULONG   BPS;            /* line rate (bits/sec) */
  122.     ULONG   HardwareType;   /* what the wire is (see below) */
  123.     ULONG   RawMTU;         /* maximum raw packet data size */
  124.     /*
  125.     ** Format specific information
  126.     */
  127. };
  128.  
  129. /*
  130. ** Defined Hardware types
  131. **
  132. **  If your hardware type is not listed below contact Amiga to get
  133. **  a new type number added for your hardware.
  134. */
  135. #define S2WireType_Ethernet    1
  136. #define S2WireType_IEEE802     6
  137. #define S2WireType_Arcnet      7
  138. #define S2WireType_LocalTalk  11
  139. #define S2WireType_DyLAN      12
  140.  
  141. #define S2WireType_AmokNet   200 /* Amiga Floppy Port hardware */
  142.  
  143. #define S2WireType_Liana     202 /* Village Tronic parallel port hw */
  144.  
  145. #define S2WireType_PPP       253
  146. #define S2WireType_SLIP      254
  147. #define S2WireType_CSLIP     255 /* Compressed SLIP */
  148.  
  149. #define S2WireType_PLIP      420 /* SLIP over a parallel port */
  150.  
  151. /*
  152. ** Filled in by 'S2_GETTYPESTATS'
  153. */
  154. struct Sana2PacketTypeStats
  155. {
  156.     ULONG PacketsSent;     /* transmitted count */
  157.     ULONG PacketsReceived; /* received count */
  158.     ULONG BytesSent;       /* bytes transmitted count */
  159.     ULONG BytesReceived;   /* bytes received count */
  160.     ULONG PacketsDropped;  /* packets dropped count */
  161. };
  162.  
  163. /*
  164. ** Filled in by 'S2_GETSPECIALSTATS'
  165. */
  166. struct Sana2SpecialStatRecord
  167. {
  168.     ULONG  Type;   /* statistic identifier */
  169.     ULONG  Count;  /* the statistic */
  170.     STRPTR String; /* statistic name */
  171. };
  172.  
  173. struct Sana2SpecialStatHeader
  174. {
  175.     ULONG RecordCountMax;      /* room available */
  176.     ULONG RecordCountSupplied; /* number supplied */
  177.     /* struct Sana2SpecialStatRecord[RecordCountMax]; */
  178. };
  179.  
  180. /*
  181. ** Filled in by 'S2_GETGLOBALSTATS'
  182. */
  183. struct Sana2DeviceStats
  184. {
  185.     ULONG          PacketsReceived;      /* received count */
  186.     ULONG          PacketsSent;          /* transmitted count */
  187.     ULONG          BadData;              /* bad packets received */
  188.     ULONG          Overruns;             /* hardware miss count */
  189.     ULONG          Unused;               /* Unused field */
  190.     ULONG          UnknownTypesReceived; /* orphan count */
  191.     ULONG          Reconfigurations;     /* network reconfigurations */
  192.     struct timeval LastStart;            /* time of last online */
  193. };
  194.  
  195. /*
  196. ** A 64 bit big endian integer in ISO 'C' terms.
  197. */
  198. typedef struct
  199. {
  200.     ULONG s2q_High;
  201.     ULONG s2q_Low;
  202. } S2QUAD;
  203.  
  204. /*
  205. ** Revised version, filled in by 'S2_GETEXTENDEDGLOBALSTATS'
  206. */
  207. struct Sana2ExtDeviceStats
  208. {
  209.     ULONG          s2xds_Length;
  210.     ULONG          s2xds_Actual;
  211.  
  212.     S2QUAD         s2xds_PacketsReceived;
  213.     S2QUAD         s2xds_PacketsSent;
  214.     S2QUAD         s2xds_BadData;
  215.     S2QUAD         s2xds_Overruns;
  216.     S2QUAD         s2xds_UnknownTypesReceived;
  217.     S2QUAD         s2xds_Reconfigurations;
  218.     struct timeval s2xds_LastStart;
  219.  
  220.     struct timeval s2xds_LastConnected;
  221.     struct timeval s2xds_LastDisconnected;
  222.     struct timeval s2xds_TimeConnected;
  223. };
  224.  
  225. /*
  226. ** Used by 'S2_CONNECT' and 'S2_DISCONNECT'
  227. */
  228. struct Sana2Connection
  229. {
  230.    ULONG          s2c_Size;
  231.    struct MinList s2c_Options;
  232.    struct Hook    s2c_ErrorHook;
  233.    struct Hook    s2c_ConnectHook;
  234.    struct Hook    s2c_DisconnectHook;
  235.    STRPTR         s2c_Login;
  236.    STRPTR         s2c_Password;
  237. };
  238.  
  239. struct Sana2ConnectionOption
  240. {
  241.    struct MinNode s2co_MinNode;
  242.    STRPTR         s2co_Name;
  243.    STRPTR         s2co_Value;
  244. };
  245.  
  246. struct Sana2ConnectionMessage
  247. {
  248.    ULONG                    s2cm_Size;
  249.    struct Sana2Connection * s2cm_Connection;
  250.    struct IORequest *       s2cm_Request[2];
  251.    LONG                     s2cm_RequestType;
  252. };
  253.  
  254. /*
  255. ** Used by 'S2_SAMPLE_THROUGHPUT'
  256. */
  257. struct Sana2ThroughputStats
  258. {
  259.    ULONG          s2ts_Length;
  260.    ULONG          s2ts_Actual;
  261.  
  262.    struct Task *  s2ts_NotifyTask;
  263.    ULONG          s2ts_NotifyMask;
  264.  
  265.    struct timeval s2ts_StartTime;
  266.    struct timeval s2ts_EndTime;
  267.    S2QUAD         s2ts_BytesSent;
  268.    S2QUAD         s2ts_BytesReceived;
  269.    S2QUAD         s2ts_Updates;
  270. };
  271.  
  272. /*
  273. ** Used by the 'S2_Log' callback hook
  274. */
  275. struct S2LogMessage
  276. {
  277.    LONG   s2lm_Size;
  278.    ULONG  s2lm_Priority;
  279.    STRPTR s2lm_Name;
  280.    STRPTR s2lm_Message;
  281. };
  282.  
  283. /*
  284. ** Log priority levels used by the 'S2_Log' callback hook
  285. */
  286. #define S2LOG_Emergency   0 /* A panic condition */
  287. #define S2LOG_Alert       1 /* A condition that should be corrected
  288.                                immediately */
  289. #define S2LOG_Critical    2 /* Critical conditions */
  290. #define S2LOG_Error       3 /* A plain error */
  291. #define S2LOG_Warning     4 /* A warning message */
  292. #define S2LOG_Notice      5 /* Conditions that are not error conditions,
  293.                                but should possibly be handled specially */
  294. #define S2LOG_Information 6 /* An informational message */
  295. #define S2LOG_Debug       7 /* Generated only in debugging mode */
  296.  
  297. /*
  298. ** Device Commands
  299. */
  300. #define S2_START               (CMD_NONSTD)  /* First old style command */
  301.  
  302. #define S2_DEVICEQUERY         (S2_START+ 0)
  303. #define S2_GETSTATIONADDRESS   (S2_START+ 1)
  304. #define S2_CONFIGINTERFACE     (S2_START+ 2)
  305. #define S2_ADDMULTICASTADDRESS (S2_START+ 5)
  306. #define S2_DELMULTICASTADDRESS (S2_START+ 6)
  307. #define S2_MULTICAST           (S2_START+ 7)
  308. #define S2_BROADCAST           (S2_START+ 8)
  309. #define S2_TRACKTYPE           (S2_START+ 9)
  310. #define S2_UNTRACKTYPE         (S2_START+10)
  311. #define S2_GETTYPESTATS        (S2_START+11)
  312. #define S2_GETSPECIALSTATS     (S2_START+12)
  313. #define S2_GETGLOBALSTATS      (S2_START+13)
  314. #define S2_ONEVENT             (S2_START+14)
  315. #define S2_READORPHAN          (S2_START+15)
  316. #define S2_ONLINE              (S2_START+16)
  317. #define S2_OFFLINE             (S2_START+17)
  318.  
  319. #define S2_END                 (S2_START+18) /* Last old style command */
  320.  
  321. /*
  322. ** New style commands introduced in 1997 and beyond
  323. */
  324. #define S2_ADDMULTICASTADDRESSES  0xC000
  325. #define S2_DELMULTICASTADDRESSES  0xC001
  326. #define S2_GETPEERADDRESS         0xC002
  327. #define S2_GETDNSADDRESS          0xC003
  328. #define S2_GETEXTENDEDGLOBALSTATS 0xC004
  329. #define S2_CONNECT                0xC005
  330. #define S2_DISCONNECT             0xC006
  331. #define S2_SAMPLE_THROUGHPUT      0xC007
  332.  
  333. /*
  334. ** Defined errors for io_Error (see also <exec/errors.h>)
  335. */
  336. #define S2ERR_NO_ERROR       0 /* peachy-keen */
  337. #define S2ERR_NO_RESOURCES   1 /* resource allocation failure  */
  338. #define S2ERR_BAD_ARGUMENT   3 /* garbage somewhere */
  339. #define S2ERR_BAD_STATE      4 /* inappropriate state */
  340. #define S2ERR_BAD_ADDRESS    5 /* who? */
  341. #define S2ERR_MTU_EXCEEDED   6 /* too much to chew */
  342. #define S2ERR_NOT_SUPPORTED  8 /* hardware can't support cmd */
  343. #define S2ERR_SOFTWARE       9 /* software error detected */
  344. #define S2ERR_OUTOFSERVICE  10 /* driver is OFFLINE */
  345. #define S2ERR_TX_FAILURE    11 /* Transmission attempt failed */
  346.  
  347. /*
  348. ** From <exec/errors.h>
  349. **
  350. **  IOERR_OPENFAIL   (-1) * device/unit failed to open *
  351. **  IOERR_ABORTED    (-2) * request terminated early [after AbortIO()] *
  352. **  IOERR_NOCMD      (-3) * command not supported by device *
  353. **  IOERR_BADLENGTH  (-4) * not a valid length (usually IO_LENGTH) *
  354. **  IOERR_BADADDRESS (-5) * invalid address (misaligned or bad range) *
  355. **  IOERR_UNITBUSY   (-6) * device opens ok, but requested unit is busy *
  356. **  IOERR_SELFTEST   (-7) * hardware failed self-test *
  357. */
  358.  
  359. /*
  360. ** Defined errors for ios2_WireError
  361. */
  362. #define S2WERR_GENERIC_ERROR      0 /* no specific info available */
  363. #define S2WERR_NOT_CONFIGURED     1 /* unit not configured */
  364. #define S2WERR_UNIT_ONLINE        2 /* unit is currently online */
  365. #define S2WERR_UNIT_OFFLINE       3 /* unit is currently offline */
  366. #define S2WERR_ALREADY_TRACKED    4 /* protocol already tracked */
  367. #define S2WERR_NOT_TRACKED        5 /* protocol not tracked */
  368. #define S2WERR_BUFF_ERROR         6 /* buff mgt func returned error */
  369. #define S2WERR_SRC_ADDRESS        7 /* source address problem */
  370. #define S2WERR_DST_ADDRESS        8 /* destination address problem */
  371. #define S2WERR_BAD_BROADCAST      9 /* broadcast address problem */
  372. #define S2WERR_BAD_MULTICAST     10 /* multicast address problem */
  373. #define S2WERR_MULTICAST_FULL    11 /* multicast address list full */
  374. #define S2WERR_BAD_EVENT         12 /* unsupported event class */
  375. #define S2WERR_BAD_STATDATA      13 /* statdata failed sanity check */
  376. /*** THERE IS NO WIRE ERROR CODE 14 ***/
  377. #define S2WERR_IS_CONFIGURED     15 /* attempt to config twice */
  378. #define S2WERR_NULL_POINTER      16 /* null pointer detected */
  379. #define S2WERR_TOO_MANY_RETRIES  17 /* tx failed - too many retries */
  380. #define S2WERR_RCVREL_HDW_ERR    18 /* Driver fixable HW error */
  381. #define S2WERR_UNIT_DISCONNECTED 19 /* unit is currently not connected */
  382. #define S2WERR_UNIT_CONNECTED    20 /* unit is currently connected */
  383. #define S2WERR_INVALID_OPTION    21 /* invalid option rejected */
  384. #define S2WERR_MISSING_OPTION    22 /* a mandatory option is missing */
  385. #define S2WERR_AUTHENTICATION_FAILED 23 /* could not log in */
  386. /*
  387. ** For our dsylexic friends
  388. */
  389. #define S2WERR_TOO_MANY_RETIRES S2WERR_TOO_MANY_RETRIES
  390.  
  391. /*
  392. ** Defined events
  393. */
  394. #define S2EVENT_ERROR         (1L<< 0) /* error catch all */
  395. #define S2EVENT_TX            (1L<< 1) /* transmitter error catch all  */
  396. #define S2EVENT_RX            (1L<< 2) /* receiver error catch all */
  397. #define S2EVENT_ONLINE        (1L<< 3) /* unit is in service */
  398. #define S2EVENT_OFFLINE       (1L<< 4) /* unit is not in service */
  399. #define S2EVENT_BUFF          (1L<< 5) /* buff mgt function error */
  400. #define S2EVENT_HARDWARE      (1L<< 6) /* hardware error catch all */
  401. #define S2EVENT_SOFTWARE      (1L<< 7) /* software error catch all */
  402. #define S2EVENT_CONFIGCHANGED (1L<< 8) /* driver configuration changed */
  403. #define S2EVENT_CONNECT       (1L<< 9) /* driver has opened session */
  404. #define S2EVENT_DISCONNECT    (1L<<10) /* driver has closed session */
  405.  
  406. #endif  /* SANA2_SANA2DEVICE_H */
  407.  
  408.